Creating a bioscrape model is simple, you could use the bioscrape API to write a simple Python script to generate the bioscrape XML, or you could simple write your own bioscrape XML file. This notebook describes both of these methods.
You could also import SBML models into bioscrape, this is demonstrated at the end.
In [1]:
from bioscrape.types import Model
species = ['X']
reactions = [(['X'], [], 'massaction', {'k':'d1'}), ([], ['X'], 'massaction', {'k':'k1'})]
k1 = 10.0
d1 = .2
params = [('k1', k1), ('d1', d1)]
initial_condition = {'X':0}
M = Model(species = species, reactions = reactions, parameters = params,
initial_condition_dict = initial_condition)
Now write the model to an XML file (the XML file is printed here as well)
In [2]:
M.write_bioscrape_xml('models/txtl_model.xml')
f = open('models/txtl_model.xml')
print("Bioscrape Model XML:\n", f.read())
In [3]:
from bioscrape.sbmlutil import import_sbml
from bioscrape.types import Model
M = Model()
M_imported = import_sbml('models/repressilator_sbml.xml', bioscrape_model = M)
M_imported is the bioscrape Model object imported from the SBML filename above.
In [4]:
M_imported.get_species_dictionary()
Out[4]:
In [ ]: